import $api from '@/http/api.js'


export default {

    namespaced: true,
    state: {
        rows: []
    },
    mutations: {
        "SET_DATA"(state, rows) {
            state.rows = rows
        }
    },
    actions: {
        async addDataAsync(context, res) {
            const { data } = await $api.admins.addAdmins(res)
            return data
        },
        async getDataAsync(context, res) {
            const { data } = await $api.admins.getAllAdmins(res)
            console.log(data);
            if (data.code == 200) {
                context.commit("SET_DATA", data.message)
            }
        },
        async delDataAsync(context, res) {
            console.log(res);
            const { data } = await $api.admins.delAdmins(res)
            return data
        },
        async login(context, res) {
            console.log(res);
            const { data } = await $api.admins.login(res)
            return data

        }
    }
}